package net.wexoo.onlinedivelog.reusable.panel;

import java.util.List;

import org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
import org.apache.wicket.markup.html.panel.Panel;

public abstract class AbstractTablePanel<T> extends Panel {

  private static final long serialVersionUID = 1L;

  public AbstractTablePanel(String id, ISortableDataProvider<T> dataProvider) {
    super(id);

    setOutputMarkupId(true);

    buildDataTable(dataProvider);
  }

  protected void buildDataTable(ISortableDataProvider<T> dataProvider) {
    add(new DefaultDataTable<T>("beanTable", buildColumns(), dataProvider, 15));
  }

  protected abstract List<IColumn<T>> buildColumns();
}